
const map = Object.assign({},  
    require('./main'), 
  );
  function send(res,data){
      res.setHeader("Access-Control-Allow-Origin", "*");
      res.setHeader("Access-Control-Allow-Headers", "Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild");
      res.setHeader("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
      res.setHeader("X-Powered-By","3.2.1");
      res.setHeader("Content-Type", "application/json;charset=utf-8");
  
      res.writeHead(200, {'Content-Type': 'application/json;charset=utf-8'});
      res.end(JSON.stringify(data));
  }
  
  const http = require('http');
  const url = require("url");
  const keys = Object.keys(map)
  http.createServer((req,res)=>{
      var parms = url.parse(req.url,true);// path query 
      console.log(1,req.url); 
      send(res,map[parms.pathname]||  { url:req.url,"code": "", "data":  keys, "msg": "", "success": true });	
  }).listen(9999, '127.0.0.1', () => {
      console.log(`Server is running....  `); 
  });
  